package org.codeart.flyweight.demo2;

public class Client {

    public static void main(String[] args) {
        GobangFactory factory = GobangFactory.getInstance();
        GobangFlyweight black1 = factory.getGobang("black");
        GobangFlyweight black2 = factory.getGobang("black");
        GobangFlyweight black3 = factory.getGobang("black");
        System.out.println("判断黑子是否是同一个对象: " + (black1 == black2));

        GobangFlyweight white1 = factory.getGobang("white");
        GobangFlyweight white2 = factory.getGobang("white");
        System.out.println(white1 == white2);
        
        // 显示棋子
        black1.display();
        black2.display();
        black3.display();
        
        white1.display();
        white2.display();
    }

}
